const canvas = document.querySelector("#canvas");
const context = canvas.getContext("2d");

const offsetCanvas = document.createElement("canvas");
const offsetContext = offsetCanvas.getContext("2d");

const scale = 2.0;
const w = canvas.width;
const h = canvas.height;
const sw = w * scale;
const sh = h * scale;

offsetCanvas.width = canvas.width;
offsetCanvas.height = canvas.height;

const img = new Image();
img.src = "./desktop.png";
img.onload = e => {
    offsetContext.drawImage(img, 0, 0, canvas.width, canvas.height);
    context.drawImage(
        offsetCanvas,
        0,
        0,
        offsetCanvas.width,
        offsetCanvas.height,
        -sw / 2 + w / 2,
        -sh / 2 + h / 2,
        sw,
        sh
    );
};
